/**
*    带图片的弹窗组件说明：为便于维护，每种弹窗写成一个组件。需要再要调用的page页中引入。
*    比如 转入实盘提示 的弹窗，就要在交易页中：
*     1): import TradeToRealModal from 'components/modal/TradeToRealModal',
*     2): components:{ }中添加'trade-to-real-modal':TradeToRealModal，
*     3): 模板中添加< trade-to-real-modal>< /trade-to-real-modal>标签
*     4): 调用：this.$store.dispatch('setModal', {visible: true, modalId: 'tradeToRealModal',stockCode:'',marketCd:'',tradeType:''});
*     有些不带业务操作的弹窗只要传visible和modalId。不同带业务操作的弹窗传的额外参数不同
**/

<template>
  <div>
    <header-top :option="headerOption"></header-top>
    <input type="checkbox" v-model="checked" id="push">
    <label>{{checked}}</label>

    <input class="modalTestBtn" type="button" value="loading" @click.stop.prevent="loadingTip"/>

    <base-modal></base-modal>
    <input class="modalTestBtn" type="button" value="base-modal" @click.stop.prevent="baseModal"/>

    <game-all-fighting-modal></game-all-fighting-modal>
    <input class="modalTestBtn" type="button" value="目前无比赛结束弹窗" @click.stop.prevent="gameAllFightingModal"/>

    <game-name-format-modal></game-name-format-modal>
    <input class="modalTestBtn" type="button" value="比赛名称有点小意见" @click.stop.prevent="gameNameFormatModal"/>

    <game-name-same-modal></game-name-same-modal>
    <input class="modalTestBtn" type="button" value="比赛重名了" @click.stop.prevent="gameNameSameModal"/>

    <game-fee-high-modal></game-fee-high-modal>
    <input class="modalTestBtn" type="button" value="参赛门槛过高" @click.stop.prevent="gameFeeHighModal"/>

    <game-pwd-format-modal></game-pwd-format-modal>
    <input class="modalTestBtn" type="button" value="看不懂参赛口令" @click.stop.prevent="gamePwdFormatModal"/>

    <game-build-fail-modal></game-build-fail-modal>
    <input class="modalTestBtn" type="button" value="比赛创建失败" @click.stop.prevent="gameBuildFailModal"/>

    <game-delete-modal></game-delete-modal>
    <input class="modalTestBtn" type="button" value="比赛已经失效不能查看啦" @click.stop.prevent="gameDeleteModal"/>

    <game-not-login-modal></game-not-login-modal>
    <input class="modalTestBtn" type="button" value="参赛用户的持仓只有注册用户才能看" @click.stop.prevent="gameNotLoginModal"/>

    <game-not-start-modal></game-not-start-modal>
    <input class="modalTestBtn" type="button" value="比赛尚未开始" @click.stop.prevent="gameNotStartModal"/>

    <game-pwd-input-modal></game-pwd-input-modal>
    <input class="modalTestBtn" type="button" value="需要输入参赛口令" @click.stop.prevent="gamePwdInputModal"/>

    <game-register-succ-modal></game-register-succ-modal>
    <input class="modalTestBtn" type="button" value="比赛报名成功" @click.stop.prevent="gameRegisterSuccModal"/>

    <group-clearance-modal></group-clearance-modal>
    <input class="modalTestBtn" type="button" value="确认要清仓吗？" @click.stop.prevent="groupClearanceModal"/>

    <group-empty-modal></group-empty-modal>
    <input class="modalTestBtn" type="button" value="组合已经空仓许久" @click.stop.prevent="groupEmptyModal"/>

    <group-learn-two-modal></group-learn-two-modal>
    <input class="modalTestBtn" type="button" value="今天偷师了两个组合啊" @click.stop.prevent="groupLearnTwoModal"/>

    <group-position-high-modal></group-position-high-modal>
    <input class="modalTestBtn" type="button" value="总仓位不能大于100%" @click.stop.prevent="groupPositionHighModal"/>

    <group-position-zero-modal></group-position-zero-modal>
    <input class="modalTestBtn" type="button" value="组合中有股票购买数为0" @click.stop.prevent="groupPositionZeroModal"/>

    <group-set-name-modal></group-set-name-modal>
    <input class="modalTestBtn" type="button" value="设置组合名称" @click.stop.prevent="groupSetNameModal"/>

    <group-set-name-succ-modal></group-set-name-succ-modal>
    <input class="modalTestBtn" type="button" value="设置组合名称成功" @click.stop.prevent="groupSetNameSuccModal"/>

    <relive-modal></relive-modal>
    <input class="modalTestBtn" type="button" value="确认一键复活？" @click.stop.prevent="reliveModal"/>

    <subscribe-cancel-modal></subscribe-cancel-modal>
    <input class="modalTestBtn" type="button" value="确认要取消订阅TA么" @click.stop.prevent="subscribeCancelModal"/>

    <subscribe-modal></subscribe-modal>
    <input class="modalTestBtn" type="button" value="订阅牛人" @click.stop.prevent="subscribeModal"/>

    <subscribe-price-modal></subscribe-price-modal>
    <input class="modalTestBtn" type="button" value="设置订阅价格" @click.stop.prevent="subscribePriceModal"/>

    <time-clear-modal></time-clear-modal>
    <input class="modalTestBtn" type="button" value="清算时间" @click.stop.prevent="timeClearModal"/>

    <time-not-trade-modal></time-not-trade-modal>
    <input class="modalTestBtn" type="button" value="非交易时间" @click.stop.prevent="timeNotTradeModal"/>

    <trade-to-real-modal></trade-to-real-modal>
    <input class="modalTestBtn" type="button" value="您即将转入实盘" @click.stop.prevent="tradeToRealModal"/>

    <fund-commit-modal></fund-commit-modal>
    <input class="modalTestBtn" type="button" value="基金操作提交成功" @click.stop.prevent="fundCommitModal"/>
    <fund-divide-notset-modal></fund-divide-notset-modal>
    <input class="modalTestBtn" type="button" value="分红方式暂不可修改" @click.stop.prevent="fundDivideNotsetModal"/>
    <fund-divide-setsucc-modal></fund-divide-setsucc-modal>
    <input class="modalTestBtn" type="button" value="分红方式设置成功" @click.stop.prevent="fundDivideSetsuccModal"/>
    <fund-need-know-modal></fund-need-know-modal>
    <input class="modalTestBtn" type="button" value="基金-用户须知" @click.stop.prevent="fundNeedKnowModal"/>

    <team-join-modal></team-join-modal>
    <input class="modalTestBtn" type="button" value="团队赛参赛成功" @click.stop.prevent="teamJoinModal"/>

    <team-login-modal></team-login-modal>
    <input class="modalTestBtn" type="button" value="团队赛参赛需注册" @click.stop.prevent="teamLoginModal"/>

  </div>
</template>

<script>
  import Constant from 'common/constant'
  import HeaderTop from 'components/HeaderTop'
  import BaseModal from 'components/modal/BaseModal'
  import GameAllFightingModal from 'components/modal/GameAllFightingModal'
  import GameBuildFailModal from 'components/modal/GameBuildFailModal'
  import GameFeeHighModal from 'components/modal/GameFeeHighModal'
  import GameNameFormatModal from 'components/modal/GameNameFormatModal'
  import GameNameSameModal from 'components/modal/GameNameSameModal'
  import GamePwdFormatModal from 'components/modal/GamePwdFormatModal'
  import GameDeleteModal from 'components/modal/GameDeleteModal'
  import GameNotLoginModal from 'components/modal/GameNotLoginModal'
  import GameNotStartModal from 'components/modal/GameNotStartModal'
  import GamePwdInputModal from  'components/modal/GamePwdInputModal'
  import GameRegisterSuccModal from 'components/modal/GameRegisterSuccModal'
  import GroupClearanceModal from 'components/modal/GroupClearanceModal'
  import GroupEmptyModal from 'components/modal/GroupEmptyModal'
  import GroupLearnTwoModal from 'components/modal/GroupLearnTwoModal'
  import GroupPositionHighModal from 'components/modal/GroupPositionHighModal'
  import GroupPositionZeroModal from 'components/modal/GroupPositionZeroModal'
  import GroupSetNameModal from 'components/modal/GroupSetNameModal'
  import GroupSetNameSuccModal from 'components/modal/GroupSetNameSuccModal'
  import ReliveModal from 'components/modal/ReliveModal'
  import SubscribeCancelModal from 'components/modal/SubscribeCancelModal'
  import SubscribeModal from 'components/modal/SubscribeModal'
  import SubscribePriceModal from 'components/modal/SubscribePriceModal'
  import TimeClearModal from 'components/modal/TimeClearModal'
  import TimeNotTradeModal from 'components/modal/TimeNotTradeModal'
  import TradeToRealModal from 'components/modal/TradeToRealModal'
  import FundCommitModal from 'components/modal/fund/FundCommitModal'
  import FundDivideNotsetModal from 'components/modal/fund/FundDivideNotsetModal'
  import FundDivideSetsuccModal from 'components/modal/fund/FundDivideSetsuccModal'
  import FundNeedKnowModal from 'components/modal/fund/FundNeedKnowModal'
  import TeamJoinModal from 'components/modal/team/TeamJoinModal'
  import TeamLoginModal from 'components/modal/team/TeamLoginModal'

  export default {
    data(){
      return{
        headerOption: {
          title: '弹窗示例页',
          leftBtn: Constant.leftBtn.CLOSE,
          operations: []
        },
        checked:''
      }
    },
    components: {
      'header-top':HeaderTop,
      'base-modal':BaseModal,
      'game-all-fighting-modal':GameAllFightingModal,
      'game-build-fail-modal':GameBuildFailModal,
      'game-fee-high-modal':GameFeeHighModal,
      'game-name-format-modal':GameNameFormatModal,
      'game-name-same-modal':GameNameSameModal,
      'game-pwd-format-modal':GamePwdFormatModal,
      'game-delete-modal':GameDeleteModal,
      'game-not-login-modal':GameNotLoginModal,
      'game-not-start-modal':GameNotStartModal,
      'game-pwd-input-modal':GamePwdInputModal,
      'game-register-succ-modal':GameRegisterSuccModal,
      'group-clearance-modal':GroupClearanceModal,
      'group-empty-modal':GroupEmptyModal,
      'group-learn-two-modal':GroupLearnTwoModal,
      'group-position-high-modal':GroupPositionHighModal,
      'group-position-zero-modal':GroupPositionZeroModal,
      'group-set-name-modal':GroupSetNameModal,
      'group-set-name-succ-modal':GroupSetNameSuccModal,
      'relive-modal':ReliveModal,
      'subscribe-cancel-modal':SubscribeCancelModal,
      'subscribe-modal':SubscribeModal,
      'subscribe-price-modal':SubscribePriceModal,
      'time-clear-modal':TimeClearModal,
      'time-not-trade-modal':TimeNotTradeModal,
      'trade-to-real-modal':TradeToRealModal,
      'fund-commit-modal':FundCommitModal,
      'fund-divide-notset-modal':FundDivideNotsetModal,
      'fund-divide-setsucc-modal':FundDivideSetsuccModal,
      'fund-need-know-modal':FundNeedKnowModal,
      'team-join-modal':TeamJoinModal,
      'team-login-modal':TeamLoginModal
    },
    methods: {
      loadingTip(){
        if(this.$store.state.loading.visible){
          this.$store.dispatch('setLoading', {visible: false});
        }else{
          this.$store.dispatch('setLoading', {visible: true});
        }
      },
      baseModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'baseModal'});
      },
      gameAllFightingModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameAllFightingModal'});
      },
      gameNameFormatModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameNameFormatModal'});
      },
      gameNameSameModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameNameSameModal'});
      },
      gameFeeHighModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameFeeHighModal'});
      },
      gamePwdFormatModal(){
        this.$store.dispatch('setModal', {visible: true ,modalId: 'gamePwdFormatModal'});
      },
      gameBuildFailModal(){
        var reason = '您参加和创建的比赛个数之和已超过3个，不能创建比赛了';
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameBuildFailModal',reason:reason});
      },
      gameDeleteModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameDeleteModal'});
      },
      gameNotLoginModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameNotLoginModal'});
      },
      gameNotStartModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameNotStartModal'});
      },
      gamePwdInputModal(){
        //gameId 比赛id   createrUser:要参赛人的Id
        this.$store.dispatch('setModal', {visible: true, modalId: 'gamePwdInputModal',gameId:'',createUser:''});
      },
      gameRegisterSuccModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'gameRegisterSuccModal'});
      },
      groupClearanceModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'groupClearanceModal',groupId:''});
      },
      groupEmptyModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'groupEmptyModal'});
      },
      groupLearnTwoModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'groupLearnTwoModal'});
      },
      groupPositionHighModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'groupPositionHighModal'});
      },
      groupPositionZeroModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'groupPositionZeroModal'});
      },
      groupSetNameModal(){
        //callback:回调函数，若Number(response.error) === 0,则操作成功 response:{error:0,name:'newname'}
        this.$store.dispatch('setModal', {visible: true, modalId: 'groupSetNameModal',groupId:'',callback:function(response){}});
      },
      groupSetNameSuccModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'groupSetNameSuccModal'});
      },
      reliveModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'reliveModal'});
      },
      subscribeCancelModal(){
        //订阅需传递要订阅的用户的userCode 即relationUserCode   callback:回调函数，若Number(response.error) === 0,则操作成功
        this.$store.dispatch('setModal', {visible: true, modalId: 'subscribeCancelModal',relationUserCode:'',callback:function(response){}});
      },
      subscribeModal(){
        //取消需传递订阅的用户的userCode 即relationUserCode;   callback:回调函数，若Number(response.error) === 0,则操作成功
        this.$store.dispatch('setModal', {visible: true, modalId: 'subscribeModal',relationUserCode:'',callback:function(response){}});
      },
      subscribePriceModal(){
        //callback:回调函数，若Number(response.error) === 0,则操作成功  response:{error:0,subscribePrice:'newsubscribePrice'}
        this.$store.dispatch('setModal', {visible: true, modalId: 'subscribePriceModal',callback:function(response){}});
      },
      timeClearModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'timeClearModal'});
      },
      timeNotTradeModal(){
        this.$store.dispatch('setModal', {visible: true, modalId: 'timeNotTradeModal'});
      },
      tradeToRealModal(){
        //转入实盘弹窗 需传当前交易界面上的股票代码stockCode  股票市场marketCd  和是买入界面还是卖出界面的tradeType（'sell'或'buy'
        this.$store.dispatch('setModal', {visible: true, modalId: 'tradeToRealModal',stockCode:'',marketCd:'',tradeType:''});
      },
      fundCommitModal(){
        this.$store.dispatch('setModal',{visible:true,entrustBs:2,ofname:'基金名称',entrustAmt:'1000',modalId:Constant.modal.FUND_COMMIT_MODAL});
      },
      fundDivideNotsetModal(){
        this.$store.dispatch('setModal',{visible:true,modalId:Constant.modal.FUND_DIVIDE_NOTSET_MODAL});
      },
      fundDivideSetsuccModal(){
        this.$store.dispatch('setModal',{visible:true,ofname:'基金名字',divideMethod:'分红方式',modalId:Constant.modal.FUND_DIVIDE_SETSUCC_MODAL});
      },
      fundNeedKnowModal(){
        this.$store.dispatch('setModal',{visible:true,modalId:Constant.modal.FUND_NEED_KNOW_MODAL});
      },
      teamJoinModal(){
        this.$store.dispatch('setModal',{visible:true,modalId:'teamJoinModal'});
      },
      teamLoginModal(){
        this.$store.dispatch('setModal',{visible:true,modalId:'teamLoginModal'});
      }
    }
  }
</script>

<style scoped>
  .modalTestBtn{
    margin: 10px !important;
    padding: 3px !important;
  }
</style>
